﻿//-----------------------------------------------------------------------------
// <copyright file="ServicesBase.cs" company="William E. Kempf">
//     Copyright (c) William E. Kempf.
// </copyright>
//-----------------------------------------------------------------------------

namespace Onyx.Windows
{
    using System;
    using Onyx.ComponentModel;

    /// <summary>
    /// Base class for objects that provide service implementations.
    /// </summary>
    internal class ServicesBase
    {
        /// <summary>
        /// Adds the services this instance implements.
        /// </summary>
        /// <param name="serviceContainer">The service container.</param>
        public void AddServices(IServiceRegistry serviceContainer)
        {
            Type type = this.GetType();
            foreach (Type interfaceType in type.GetInterfaces())
            {
                serviceContainer.RegisterService(interfaceType, this);
            }
        }
    }
}
